<?php

/**
 * Require main config file
 */
require_once('config.php');

require_once('classmap.php');

require_once(Config::$classesDir . '/core/Loader.class.php');

Loader::register($classMap);


/**
 * autoload classes
 *
 * @param string $className
 */
function __autoload($className) {
	try {
		Loader::load($className);
	}
	catch (Exception $e) {
		die('Fatal error ' . $e->getMessage());
	}
}

/**
 * Debug function.
 *
 * @param mixed $var
 * @param boolean $exit
 */
function d($var, $exit=true){
	echo '<pre><div style="border: 1px solid red; width:550px; background-color: #eaeaea">';
	print_r($var);
	echo '</div></pre>';
	if($exit){
		exit;
	}
}